﻿using CRM.Infrastructure.Dto;
using CRM.Infrastructure.Models;
using CRM.Infrastructure.Service;
using Dapper.Extensions;
using System.Collections.Generic;
using System.Web.Mvc;

namespace CRM.Op.Controllers
{
    public class ReportController : BaseController
    {
        CallReportService _service = new CallReportService();

        /// <summary>
        /// 获取呼叫报表
        /// </summary>
        /// <returns></returns>
        public ViewResult CallReport()
        {
            return View();
        }


        /// <summary>
        /// 查询列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ContentResult GetCallList(SearchCallModel model)
        {
            //普通用户只能查看自己的
            if (CurrentUser.RoleID == 10000)
            {
                model.CompanyID = -1;
                var page = _service.GetPages(model);
                return ReturnResult(page);
            }
            return ReturnResult(new Page<CallDto>() { rows = new List<CallDto>(), total = 0 });
        }
    }
}